# coding: utf-8
'''
Created on May 18, 2011

@author: Adam Matysiak
'''
import unittest

import ListTDL as list

class TestTDL(unittest.TestCase):	
	
	def setUp(self):		
		self.list = list.ListTDL()
		
	def testModel(self, write = True):
		# USE CASE 1
		tc1_1 = self.list.genTC1_1()
		tc1_2 = self.list.genTC1_2()
		
		# TEST CASE 1_1				
		if write:
			print tc1_1.as_text()

		self.assertEqual(tc1_1.as_text(), self.list.getTC1_1().replace('    ', '\t'))
			
		# TEST CASE 1_2			
		if write:
			print tc1_2.as_text()

		self.assertEqual(tc1_2.as_text(), self.list.getTC1_2().replace('    ', '\t'))			
		############################################################
		# USE CASE 2		
		tc2 = self.list.genTC2({
			'tc1_1': tc1_1
		})	
			
		# TEST CASE 2
		if write:
			print tc2.as_text()

		self.assertEqual(tc2.as_text(), self.list.getTC2().replace('    ', '\t'))				
		############################################################
		# USE CASE 3	
		tc3_1 = self.list.genTC3_1({
			'tc1_1': tc1_1
		})	
		tc3_2 = self.list.genTC3_2({
			'tc1_1': tc1_1,
			'tc3_1': tc3_1
		})				
		tc3_3 = self.list.genTC3_3({
			'tc1_1': tc1_1,
			'tc3_2': tc3_2
		})		
		tc3_4 = self.list.genTC3_4({
			'tc1_1': tc1_1,
			'tc3_3': tc3_3
		})		
				
		# TEST CASE 3_1		
		if write:
			print tc3_1.as_text()

		self.assertEqual(tc3_1.as_text(), self.list.getTC3_1().replace('    ', '\t'))
		
		# TEST CASE 3_2
		if write:
			print tc3_2.as_text()

		self.assertEqual(tc3_2.as_text(), self.list.getTC3_2().replace('    ', '\t'))
		
		# TEST CASE 3_3
		if write:
			print tc3_3.as_text()

		self.assertEqual(tc3_3.as_text(), self.list.getTC3_3().replace('    ', '\t'))
		
		# TEST CASE 3_4
		if write:
			print tc3_4.as_text()

		self.assertEqual(tc3_4.as_text(), self.list.getTC3_4().replace('    ', '\t'))				
		############################################################	
		# USE CASE 4		
		tc4 = self.list.genTC4({
			'tc1_1': tc1_1
		})	
		
		# TEST CASE 4			
		if write:
			print tc4.as_text()

		self.assertEqual(tc4.as_text(), self.list.getTC4().replace('    ', '\t'))					
		############################################################
		# USE CASE 5		
		tc5_1 = self.list.genTC5_1({
			'tc1_1': tc1_1
		})	
		tc5_2 = self.list.genTC5_2({
			'tc1_1': tc1_1
		})	
		
		# TEST CASE 5_1		
		if write:
			print tc5_1.as_text()

		self.assertEqual(tc5_1.as_text(), self.list.getTC5_1().replace('    ', '\t'))				
		
		# TEST CASE 5_2	
		if write:
			print tc5_2.as_text()

		self.assertEqual(tc5_2.as_text(), self.list.getTC5_2().replace('    ', '\t'))					
		############################################################
		# USE CASE 6			
		tc6 = self.list.genTC6({
			'tc1_1': tc1_1
		})	
		
		# TEST CASE 6
		if write:
			print tc6.as_text()

		self.assertEqual(tc6.as_text(), self.list.getTC6().replace('    ', '\t'))			
		############################################################
		# USE CASE 7	
		tc7 = self.list.genTC7({
			'tc1_1': tc1_1
		})	
		
		# TEST CASE 7			
		if write:
			print tc7.as_text()

		self.assertEqual(tc7.as_text(), self.list.getTC7().replace('    ', '\t'))		
		############################################################
		# USE CASE 8	
		tc8_1 = self.list.genTC8_1({
			'tc1_1': tc1_1
		})	
		tc8_2 = self.list.genTC8_2({
			'tc1_1': tc1_1
		})
		
		# TESTCASE 8_1				
		if write:
			print tc8_1.as_text()

		self.assertEqual(tc8_1.as_text(), self.list.getTC8_1().replace('    ', '\t'))
		
		# TESTCASE 8_2			
		if write:
			print tc8_2.as_text()

		self.assertEqual(tc8_2.as_text(), self.list.getTC8_2().replace('    ', '\t'))
		############################################################
	
if __name__ == "__main__":
	#import sys;sys.argv = ['', 'Test.testCreate']
	unittest.main()
